import fileConfApi from "@/api/declaration/fileConfApi"
import httpRequest from "@/config/axios/httpRequest"
import { FileConfModel } from "@/models/files/FileConfModel"

// 查询文件配置列表
export const getFileConfigPage = (params: PageParam) => {
  return httpRequest.get(fileConfApi.GetFileConfigPage,
    {
    params
  })
}

// 查询文件配置详情
export const getFileConfig = (id: number) => {
  return httpRequest.get(fileConfApi.GetFileConfig, {
    params: { id }
  })
}

// 更新文件配置为主配置
export const updateFileConfigMaster = (id: number) => {
  return httpRequest.put(fileConfApi.UpdateFileConfigMaster, {
    data: { id }
  })
}

// 新增文件配置
export const createFileConfig = (data: FileConfModel) => {
  return httpRequest.post(fileConfApi.CreateFileConfig, data)
}

// 修改文件配置
export const updateFileConfig = (data: FileConfModel) => {
  return httpRequest.put(fileConfApi.UpdateFileConfig, data)
}

// 删除文件配置
export const deleteFileConfig = (id: number) => {
  return httpRequest.delete(fileConfApi.DeleteFileConfig,
     { params: { id } })
}

// 测试文件配置
export const testFileConfig = (id: number) => {
  return httpRequest.get(fileConfApi.TestFileConfig, {
    params: { id }
  })
}
